package com.quick.framework.security.context;

import org.springframework.security.core.Authentication;

/**
 * 身份验证信息
 *
 * @author 吃素不吃肉
 */
public class AuthenticationContextHolder {
    private static final ThreadLocal<Authentication> AUTHENTICATION_THREAD_LOCAL = new ThreadLocal<>();

    public static Authentication getContext() {
        return AUTHENTICATION_THREAD_LOCAL.get();
    }

    public static void setContext(Authentication context) {
        AUTHENTICATION_THREAD_LOCAL.set(context);
    }

    public static void clearContext() {
        AUTHENTICATION_THREAD_LOCAL.remove();
    }
}
